package com.tutorial.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * 实现了方法拦截器接口
 * className: MyAdvice2
 * author: GXW
 * date: 2025/7/24 15:08:59
 * description: TODO 实现了方法拦截器接口
 */
public class MyAdvice2 implements MethodInterceptor {
	/**
	 * @param methodInvocation the method invocation joinpoint
	 * @return
	 * @throws Throwable
	 */
	@Override
	public Object invoke(MethodInvocation methodInvocation) throws Throwable {
		System.out.println("前置逻辑功能...");
		// 执行目标方法
		Object invoke = methodInvocation.getMethod().invoke(methodInvocation.getThis(), methodInvocation.getArguments());
		System.out.println("后置逻辑功能...");
		return invoke;
	}
}
